home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / dll_gen / drvplus / drvplus.bas < prev    next >
BASIC Source File  |  1994-06-06  |  10KB  |  246 lines

  1. 'DrvPlus.DLL should be in your Windows\System directory or in the Path
  2.  
  3.  
  4. 'RAM information
  5. Declare Function GetRamSize& Lib "DrvPlus.DLL" (ByVal RamType%)
  6.     Global Const BaseRam = 1
  7.     Global Const HwRam = 2
  8.     Global Const ExtRam = 3
  9.     Global Const TotalRam = 4
  10.  
  11.  
  12. 'Drive Information
  13. Declare Function HowManyFloppies% Lib "DrvPlus.DLL" ()
  14. Declare Function SetDefaultDrive% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  15. Declare Function GetDefaultDrive% Lib "DrvPlus.DLL" ()
  16. Declare Function GetBootDrive% Lib "DrvPlus.DLL" ()
  17. Declare Function GetDriveFree& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  18. Declare Function GetDriveSize& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  19.     'if return value of GetDriveSize& is 0, then the drive is invalid
  20. Declare Function GetDriveUsed& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  21. Declare Function GetClustersOnDrive& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  22. Declare Function GetSectorsPerCluster& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  23. Declare Function GetBytesPerSector& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  24. Declare Function HowManyCDdrives% Lib "DrvPlus.DLL" ()
  25. Declare Function IsDriveCD% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  26. Declare Function IsDriveRemovable% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  27. Declare Function IsDriveLocal% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  28. Declare Function IsDriveLocalShared% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  29. Declare Function IsDriveSubst% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
  30.  
  31. 'file functions
  32. Declare Function SetVolName% Lib "DrvPlus.DLL" (ByVal DriveNbr%, ByVal lpVolName$)
  33. Declare Function SetFileDate% Lib "DrvPlus.DLL" (ByVal lpString$, ByVal TheYear%, ByVal TheMonth%, ByVal TheDate%)
  34.     'SetFileDate returns true if successful; else false
  35. Declare Function SetFileTime% Lib "DrvPlus.DLL" (ByVal lpString$, ByVal TheHours%, ByVal TheMinutes%)
  36.     'SetFileTime returns true if successful; else false
  37.     'hours range=0-23
  38.     'minutes range=0-59
  39. Declare Sub ExtFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
  40. Declare Sub FileNameOnlyFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
  41. Declare Sub FullFileNameFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
  42. Declare Sub DirFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
  43. Declare Sub DriveFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
  44. Declare Function DoesFileExist% Lib "DrvPlus.DLL" (ByVal lpString$)
  45.  
  46.  
  47. 'Data manapilation functions
  48. Declare Function GetHighByte% Lib "DrvPlus.DLL" (ByVal OrgInt%)
  49. Declare Function GetLowByte% Lib "DrvPlus.DLL" (ByVal OrgInt%)
  50. Declare Function GetHighWord& Lib "DrvPlus.DLL" (ByVal OrgLong&)
  51. Declare Function GetLowWord& Lib "DrvPlus.DLL" (ByVal OrgLong&)
  52. Declare Function PeekByte% Lib "DrvPlus.DLL" (ByVal TheSegment%, ByVal TheOffset%)
  53.     'TheSegment and TheOffset should be a HexValue
  54. Declare Sub PokeByte Lib "DrvPlus.DLL" (ByVal TheSegment%, ByVal TheOffset%, ByVal PokeValue%)
  55.  
  56. 'DrvPlus assorted functions
  57. Declare Function GetDrvPlusVersion% Lib "DrvPlus.DLL" ()
  58.  
  59.  
  60. 'API assorted functions
  61. Declare Function GetWindowsDirectory% Lib "Kernel" (ByVal lpBuffer$, ByVal nSize%)
  62. Declare Function OutMessage% Lib "User" Alias "SendMessage" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
  63. Declare Function SendMessage& Lib "User" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
  64. Declare Function WinHelp% Lib "User" (ByVal hWnd%, ByVal lpHelpFile$, ByVal wCommand%, ByVal dwData As Any)
  65.     Global Const HELP_CONTENTS = &H3
  66.     Global Const HELP_PARTIALKEY = &H105
  67.  
  68.  
  69. 'program constants
  70. Global Const raised = 1
  71. Global Const sunken = 2
  72.  
  73.  
  74. 'program variables
  75. Global TheDateWord As String
  76. Global TheYear As String
  77. Global TheMonth As String
  78. Global TheDate As String
  79.  
  80. Global TheTimeWord As String
  81. Global TheHours As String
  82. Global TheMinutes As String
  83.  
  84. Global FormPassString As String     'used to pass strings
  85. Global FormPassString2 As String
  86.  
  87. Function AddSeparator (ThePath$)
  88.     If Right$(ThePath$, 1) <> "\" Then
  89.         ThePath$ = ThePath$ + "\"
  90.         End If
  91.     AddSeparator = ThePath$
  92. End Function
  93.  
  94. Sub DoControl3D (Obj As Control, Style%, Thick%)
  95.     If Thick <= 0 Then Thick = 1
  96.     If Thick > 8 Then Thick = 8
  97.     OldMode = Obj.Parent.ScaleMode
  98.     OldWidth = Obj.Parent.DrawWidth
  99.     Obj.Parent.ScaleMode = 3
  100.     Obj.Parent.DrawWidth = 1
  101.     ObjHeight = Obj.Height
  102.     ObjWidth = Obj.Width
  103.     ObjLeft = Obj.Left
  104.     ObjTop = Obj.Top
  105.     
  106.     Select Case Style
  107.         Case sunken:
  108.             TLshade = QBColor(8)
  109.             BRshade = QBColor(15)
  110.         Case raised:
  111.             TLshade = QBColor(15)
  112.             BRshade = QBColor(8)
  113.         End Select
  114.         For i = 1 To Thick
  115.             CurLeft = ObjLeft - i
  116.             CurTop = ObjTop - i
  117.             CurWide = ObjWidth + (i * 2) - 1
  118.             CurHigh = ObjHeight + (i * 2) - 1
  119.             Obj.Parent.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
  120.             Obj.Parent.Line -Step(0, CurHigh), BRshade
  121.             Obj.Parent.Line -Step(-CurWide, 0), BRshade
  122.             Obj.Parent.Line -Step(0, -CurHigh), TLshade
  123.             Next i
  124.         If Thick > 2 Then
  125.             CurLeft = ObjLeft - Thick - 1
  126.             CurTop = ObjTop - Thick - 1
  127.             CurWide = ObjWidth + ((Thick + 1) * 2) - 1
  128.             CurHigh = ObjHeight + ((Thick + 1) * 2) - 1
  129.             Obj.Parent.Line (CurLeft, CurTop)-Step(CurWide, 0), QBColor(0)
  130.             Obj.Parent.Line -Step(0, CurHigh), QBColor(0)
  131.             Obj.Parent.Line -Step(-CurWide, 0), QBColor(0)
  132.             Obj.Parent.Line -Step(0, -CurHigh), QBColor(0)
  133.             End If
  134.     Obj.Parent.ScaleMode = OldMode
  135.     Obj.Parent.DrawWidth = OldWidth
  136. End Sub
  137.  
  138. Sub DoForm3D (TheForm As Form, Style%, Thick%, Distance%)
  139.     If Thick <= 0 Then Thick = 1
  140.     If Thick > 8 Then Thick = 8
  141.     If Distance < 0 Then Distance = 0
  142.     If Distance > 8 Then Distance = 8
  143.     OldMode = TheForm.ScaleMode
  144.     OldWidth = TheForm.DrawWidth
  145.     TheForm.ScaleMode = 3
  146.     TheForm.DrawWidth = 1
  147.     FormHeight = TheForm.ScaleHeight
  148.     FormWidth = TheForm.ScaleWidth
  149.     FormLeft = TheForm.ScaleLeft
  150.     FormTop = TheForm.ScaleTop
  151.     
  152.     Select Case Style
  153.         Case sunken:
  154.             TLshade = QBColor(8)
  155.             BRshade = QBColor(15)
  156.         Case raised:
  157.             TLshade = QBColor(15)
  158.             BRshade = QBColor(8)
  159.         End Select
  160.     Select Case TheForm.BorderStyle
  161.         Case 0:
  162.             OLshade = QBColor(0)
  163.             TheForm.Line (0, 0)-(FormWidth, 0), OLshade
  164.             TheForm.Line (0, 0)-(0, FormHeight), OLshade
  165.             TheForm.Line (FormWidth - 1, 0)-(FormWidth - 1, FormHeight + 1), OLshade
  166.             TheForm.Line (0, FormHeight - 1)-(FormWidth, FormHeight - 1), OLshade
  167.             For i = 1 To Thick
  168.                 CurLeft = FormLeft + i + Distance
  169.                 CurTop = FormTop + i + Distance
  170.                 CurWide = FormWidth - (i + Distance) * 2 - 1
  171.                 CurHigh = FormHeight - (i + Distance) * 2 - 1
  172.                 TheForm.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
  173.                 TheForm.Line -Step(0, CurHigh), BRshade
  174.                 TheForm.Line -Step(-CurWide, 0), BRshade
  175.                 TheForm.Line -Step(0, -CurHigh), TLshade
  176.                 Next i
  177.         Case 1 To 3:
  178.             If Thickness = 1 Then
  179.                 TheForm.Line (Thick, Thick)-(FormWidth - Thick, Thick), TLshade
  180.                 TheForm.Line (Thick, Thick)-(Thick, FormHeight - Thick), TLshade
  181.                 TheForm.Line (FormWidth - Thick, Thick)-(FormWidth - Thick, FormHeight - Thick + 1), BRshade
  182.                 TheForm.Line (Thick, FormHeight - Thick)-(FormWidth - Thick, FormHeight - Thick), BRshade
  183.                 Else
  184.             For i = 1 To Thick
  185.                 CurLeft = FormLeft + i - 1 + Distance
  186.                 CurTop = FormTop + i - 1 + Distance
  187.                 CurWide = FormWidth - (i + Distance) * 2 + 1
  188.                 CurHigh = FormHeight - (i + Distance) * 2 + 1
  189.                 TheForm.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
  190.                 TheForm.Line -Step(0, CurHigh), BRshade
  191.                 TheForm.Line -Step(-CurWide, 0), BRshade
  192.                 TheForm.Line -Step(0, -CurHigh), TLshade
  193.                 Next i
  194.                 End If
  195.         End Select
  196.     TheForm.ScaleMode = OldMode
  197.     TheForm.DrawWidth = OldWidth
  198. End Sub
  199.  
  200. Sub FormCenterForm (TheForm As Form, MainForm As Form)
  201.     TheForm.Move MainForm.Left + (MainForm.Width - TheForm.Width) / 2, MainForm.Top + (MainForm.Height - TheForm.Height) / 2
  202. End Sub
  203.  
  204. Sub FormCenterScreen (TheForm As Form)
  205.     TheForm.Move (Screen.Width - TheForm.Width) / 2, (Screen.Height - TheForm.Height) / 2
  206. End Sub
  207.  
  208. Function GetWinDir ()
  209.      Buffer$ = Space$(255)
  210.      count% = GetWindowsDirectory(Buffer$, 255)
  211.      GetWinDir = Left$(Buffer$, count%)
  212. End Function
  213.  
  214. Sub ListHscroll (TheListBox As Control, CharsWide%)
  215.     If CharsWide% > 15000 Then CharsWide% = 15000
  216.     LongString$ = String$(CharsWide%, "W")
  217.     tppx% = Screen.TwipsPerPixelX
  218.     MaxiWide% = TheListBox.Parent.TextWidth(LongString$) / tppx%
  219.     HscrollLen& = SendMessage(TheListBox.hWnd, 1045, MaxiWide%, 0)
  220. End Sub
  221.  
  222. Function Strip (x As String, y As String)
  223.     Dim z As String
  224.     If Len(x) < 1 Or Len(y) < 1 Then
  225.         Strip = ""
  226.         Exit Function
  227.         End If
  228.     Start = 1
  229.     z = x
  230.     Do
  231.         pos% = InStr(x, y)
  232.         If pos% = 0 Then Strip = z: Exit Function
  233.         z = Left$(x, (pos% - 1)) + Mid$(x, pos% + Len(y), Len(x) - Len(y) - pos% + 1)
  234.         If Start = Len(x) Then Exit Do
  235.         Start = Start + 1
  236.     Loop
  237.     Strip = z
  238. End Function
  239.  
  240. Sub TrimAtNull (TheWord$)
  241.     pos% = InStr(TheWord$, Chr$(0))
  242.     If pos% = 0 Then Exit Sub
  243.     TheWord$ = Left$(TheWord$, pos% - 1)
  244. End Sub
  245.  
  246.